//
//
//
//
// 天空盒
import React from "react";
import * as THREE from "three";
import Mesh from "../Mesh/Mesh";
import Object3DComponent, { Object3DComponentProps } from "../Object3D/Object3DComponent";
import skyimgJPG from "./skyimg.jpg";

const SkyBoxGeo = new THREE.SphereBufferGeometry(1000, 30, 30); // 网格模型

export interface SkyBoxProps extends Object3DComponentProps {

    map?: THREE.Texture | string,//--------------------纹理

}

interface State { }

export default class SkyBox extends Object3DComponent<SkyBoxProps, State> {
    constructor(props: SkyBoxProps) {
        super(props);
    }


    static defaultProps = {
        map: skyimgJPG
    }

    render() {

        const { map } = this.props;

        return (
            <Mesh
                geometry={SkyBoxGeo}
                material="MeshBasicMaterial"
                side={THREE.DoubleSide}
                map={map}
                clipping={false}  // 不裁剪
            />
        );
    }

}